<template>
  <div class="Image_scoring_standard_of_ultrasound_department">
    <p class="heard_title">影像科图像评分标准</p>
    <el-tabs type="border-card" style="margin: 0 10px" @tab-click="tab_click">
      <el-tab-pane label="影像评分标准" style="height: 820px">
        <div style="margin-bottom: 5px">
          <el-input
            size="small"
            style="display: inline-block; width: 20%; margin-left: 10px"
            placeholder="请输入人员姓名"
            v-model="name_ry"
          ></el-input>
          <el-button
            size="small"
            icon="el-icon-search"
            style="margin-left: 10px"
            @click="setTable"
          ></el-button>
          <span style="margin-left: 50px; font-size: 18px">
            当前组织：<span style="font-weight: 700">{{ orgName }}</span>
            当前人员：<span style="font-weight: 700">{{ userName }}</span>
            当前表为：<span style="font-weight: 700">{{ ScoreNo }}</span>
          </span>
        </div>
        <el-row>
          <el-col :span="4">
            <el-tree
              :data="data"
              :props="defaultProps"
              @node-click="handleNodeClick"
              :highlight-current="true"
            ></el-tree>
          </el-col>
          <el-col :span="3">
            <template>
              <el-table
                :data="tableData"
                border
                style="width: 100%"
                :row-class-name="tableRowClassName"
                @row-click="row_click"
                height="735"
              >
                <el-table-column prop="Username" label="人员姓名">
                </el-table-column>
              </el-table>
            </template>
          </el-col>
          <el-col :span="15" style="padding: 0 10px">
            <transition name="el-fade-in-linear">
              <table style="width: 100%" border="1" v-show="isShow">
                <tr>
                  <td
                    colspan="4"
                    style="
                      text-align: center;
                      font-weight: 700;
                      font-size: 18px;
                      padding: 5px;
                    "
                  >
                    影像图像质量评价评分
                  </td>
                </tr>
                <tr class="tr_style">
                  <td>项目</td>
                  <td>评价内容和方法</td>
                  <td>扣分</td>
                  <td>影像id集合（多个中间用“/”隔开）</td>
                </tr>
                <tr class="tr_style">
                  <td>图像对比</td>
                  <td>看电脑图片或胶片图像，对比欠佳</td>
                  <td>
                    <el-slider
                      v-model="fromList[0].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </td>
                  <td>
                    <el-input v-model="fromList[0].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <td>图像层次</td>
                  <td>投照野过大或包括不全</td>
                  <td>
                    <el-slider
                      v-model="fromList[1].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </td>
                  <td>
                    <el-input v-model="fromList[1].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <td>投照野控制</td>
                  <td>投照野过大或包括不全</td>
                  <td>
                    <el-slider
                      v-model="fromList[2].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </td>
                  <td>
                    <el-input v-model="fromList[2].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <th rowspan="5" style="text-align: center">伪影</th>
                  <th>不影像诊断的伪影，如内衣扣、金属线</th>
                  <th>
                    <el-slider
                      v-model="fromList[3].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </th>
                  <td>
                    <el-input v-model="fromList[3].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <th>有可能误认为病变的伪影</th>
                  <th>
                    <el-slider
                      v-model="fromList[4].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </th>
                  <td>
                    <el-input v-model="fromList[4].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <th>伪影范围较大，掩盖诊断区</th>
                  <th>
                    <el-slider
                      v-model="fromList[5].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </th>
                  <td>
                    <el-input v-model="fromList[5].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <th>呼吸伪影或运动伪影</th>
                  <th>
                    <el-slider
                      v-model="fromList[6].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </th>
                  <td>
                    <el-input v-model="fromList[6].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <th>抽查胶片，有污片、划片、粘片</th>
                  <th>
                    <el-slider
                      v-model="fromList[7].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </th>
                  <td>
                    <el-input v-model="fromList[7].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <th>图像标识</th>
                  <th>不完整</th>
                  <th>
                    <el-slider
                      v-model="fromList[8].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </th>
                  <td>
                    <el-input v-model="fromList[8].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <th>图像重要标识</th>
                  <th>如左右、姓名、性别错误</th>
                  <th>
                    <el-slider
                      v-model="fromList[9].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </th>
                  <td>
                    <el-input v-model="fromList[9].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <th>摄影体位</th>
                  <th>不标准</th>
                  <th>
                    <el-slider
                      v-model="fromList[10].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </th>
                  <td>
                    <el-input v-model="fromList[10].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <th>特殊体位</th>
                  <th>无标注，如腹部立体位、水平侧位</th>
                  <th>
                    <el-slider
                      v-model="fromList[11].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </th>
                  <td>
                    <el-input v-model="fromList[11].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <th>摄影部位错误</th>
                  <th>对照申请单和摄影像部位是否一致</th>
                  <th>
                    <el-slider
                      v-model="fromList[12].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </th>
                  <td>
                    <el-input v-model="fromList[12].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <th>图像放大比例</th>
                  <th>抽查胶片，图像放大比例是否一致</th>
                  <th>
                    <el-slider
                      v-model="fromList[13].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </th>
                  <td>
                    <el-input v-model="fromList[13].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <th>用片统一，尺寸合理</th>
                  <th>抽查胶片</th>
                  <th>
                    <el-slider
                      v-model="fromList[14].Score"
                      show-input
                      @change="isNum"
                    >
                    </el-slider>
                  </th>
                  <td>
                    <el-input v-model="fromList[14].LinkNo"></el-input>
                  </td>
                </tr>
                <tr class="tr_style">
                  <th>合计</th>
                  <td style="text-align: center" colspan="3">{{ num }} 分</td>
                </tr>
              </table>
            </transition>
          </el-col>
        </el-row>
        <div style="text-align: center; margin-top: 15px">
          <el-button type="primary" @click="ADD">提 交</el-button>
          <el-button type="" @click="NNO">重 置</el-button>
        </div>
      </el-tab-pane>
      <el-tab-pane label="DR影像质量要求" style="height: 800px">
        <h3 style="text-align: center">
          DR影像质量要求
          <el-button
            size="small"
            @click="font_size_change('small')"
            style="float: right"
            >恢复大小</el-button
          >
          <el-button
            size="small"
            @click="font_size_change('big')"
            style="float: right; margin-right: 10px"
            >字体放大</el-button
          >
        </h3>
        <div :style="text_size">
          <h4 style="margin-bottom: 15px">一般要求</h4>
          <p>1、X线照片满足影像诊断要求。</p>
          <p>
            2、X线照片标识，左右标志正确，检查号、检查日期、检查医院、被检者姓名、性别、年龄、图像放大比例或比例尺等信息完整。
          </p>
          <p>
            3、用片统一，用片尺寸合理，分格规范，照射野大小控制适当。成人胸片不小于11×14英寸。
          </p>
          <p>
            4、图像放大比例一致：正位片与侧位片或斜位片放大比例一致。同一部位不同时间摄片放大比例一致。成人胸片放大比例不小于65%。
          </p>
          <p>5、整体画面布局美观，影像无失真变形。</p>
          <h4 style="margin-top: 50px; margin-bottom: 15px">
            除上述一般要求外，优质图像标准
          </h4>
          <p>1、密度合适：（照片中诊断密度范围控制在0.25-2.0之间）。</p>
          <p>
            2、层次分明：参照浙江省《放射科管理与技术规范》中放射科技术质量标准。
          </p>
          <p>
            3、摄影体位标准：参照浙江省《放射科管理与技术规范》中放射科技术质量标准。组织影像应符合正常的解剖投影，无失真。
          </p>
          <p>
            4、照射野大小合适:
            被检部位影像全部在照片上显示,但不应过多包含非检查部位，尤其是内分泌腺；重点组织界限清楚；脊柱应含相邻椎体；四肢长骨应至少包括1个邻近关节；肋骨应包括第1或第12肋骨。
          </p>
          <p>5、无体外伪影。</p>
          <p>6、无运动伪影。</p>
          <p>7、特殊检查体位应标注。</p>
          <p>8、胶片无污片、划片、粘片、指纹。</p>
        </div>
      </el-tab-pane>
      <el-tab-pane label="CT、MR影像质量要求" style="height: 800px">
        <h3 style="text-align: center">
          CT、MR影像质量要求
          <el-button
            size="small"
            @click="font_size_change('small')"
            style="float: right"
            >恢复大小</el-button
          >
          <el-button
            size="small"
            @click="font_size_change('big')"
            style="float: right; margin-right: 10px"
            >字体放大</el-button
          >
        </h3>
        <div :style="text_size">
          <p>
            1、根据临床检查要求和疾病诊断需要，合理选择扫描范围、扫描参数、检查序列。
          </p>
          <p>2、扫描范围必须包括整个被检查器官或部位。</p>
          <p>
            3、选择合适窗宽窗位，因头部外伤的头颅CT扫描必须有骨窗。肺部扫描必须有肺窗和纵隔窗。
          </p>
          <p>4、对于CT检查，在满足诊断的前提下，尽量减少X线剂量。</p>
          <p>5、增强扫描增强效果良好。</p>
          <p>6、定位标识明确，一般信息完整。</p>
          <p>7、CT、MR照片应有定位相。</p>
          <p>
            8、CT、MR照片排列顺序：横断位：躯干从上到下，四肢由近到远。冠状位：由前到后；矢状位：由右到左。
          </p>
        </div>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
export default {
  // 组件名称
  name: "",
  // 局部注册的组件
  components: {},
  // 组件参数 接收来自父组件的数据
  props: {},
  // 组件状态值
  data() {
    return {
      data: [],
      defaultProps: {
        children: "children",
        label: "label",
      },
      orgName: "",
      orgId: null,
      userName: "",
      userId: 38,
      tableData: [],
      value: 0,
      isShow: false,
      text_size: "",
      fromList: [
        {
          GradingID: 1,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 2,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 3,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 4,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 5,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 6,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 7,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 8,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 9,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 10,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 11,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 12,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 13,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 14,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 15,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
      ],
      num: 100,
      ScoreNo: "",
      name_ry: "",
    };
  },
  // 计算属性
  computed: {},
  // 侦听器
  watch: {},
  // 生命周期钩子   注：没用到的钩子请自行删除
  /**
   * 组件实例创建完成，属性已绑定，但DOM还未生成，$ el属性还不存在
   */
  created() {
    if (this.$route.query.Token != null && this.$route.query.Token != "") {
      console.log(this.$route.query.Token, "KKKKKKKKKKKKKKKKKKKKKK");
      localStorage.setItem("token", this.$route.query.Token);
    } else {
    }
  },
  /**
   * el 被新创建的 vm.el 替换，并挂载到实例上去之后调用该钩子。
   * 如果 root 实例挂载了一个文档内元素，当 mounted 被调用时 vm.el 也在文档内。
   */
  mounted() {
    this.getTreeData();
    this.getTableData();
    this.getFromData();
  },
  // 组件方法
  methods: {
    getTreeData() {
      // 获取组织树数据
      this.$post(baseUrl.hrIp + "/auth/organs/searchlist", {}).then((res) => {
        if (res.code == 1) {
          this.data = res.data;
          this.orgName = res.data[0].label;
          this.orgId = res.data[0].value;
        }
      });
    },
    handleNodeClick(data) {
      // 树点击事件
      this.orgName = data.label;
      this.orgId = data.value;
      this.isShow = false;
      this.getTableData();
    },
    getTableData() {
      // 获取人员表格数据
      this.$get(
        baseUrl.hrIp + "/hr/employees?page=1&limit=10&name=&OrgID=" + this.orgId
      ).then((res) => {
        if (res.code == 1) {
          this.tableData = res.data.list;
          this.userId = res.data.list[0].Id;
          this.userName = res.data.list[0].Username;
          setTimeout((_) => {
            this.isShow = true;
          }, 200);
        }
      });
    },
    row_click(row) {
      // 人员表格点击事件
      this.userName = row.Username;
      this.userId = row.Id;
      this.isShow = false;
      setTimeout((_) => {
        this.isShow = true;
      }, 200);
    },
    tableRowClassName({ row }) {
      // 设置人员表格高亮显示事件
      if (row.Id === this.userId) {
        return "warning-row";
      }
      return "";
    },
    tab_click() {
      // tab栏点击事件
      this.text_size = "";
    },
    font_size_change(flag) {
      // 控制字体大小事件
      if (flag == "big") {
        this.text_size = "font-size: 18px;font-weight:700";
      }
      if (flag == "small") {
        this.text_size = "";
      }
    },
    isNum() {
      // 计算合计方法
      var num = 0;
      for (var i in this.fromList) {
        num = num + this.fromList[i].Score * 1;
      }
      num >= 100 ? (this.num = 0) : (this.num = 100 - num);
    },
    NNO() {
      // 重置按钮事件
      this.fromList = [
        {
          GradingID: 1,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 2,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 3,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 4,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 5,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 6,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 7,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 8,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 9,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 10,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 11,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 12,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 13,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 14,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
        {
          GradingID: 15,
          ScoreNo: 1,
          Score: 0,
          LinkNo: "",
        },
      ];
      // this.ScoreNo = ''
      this.isNum();
    },
    ADD() {
      // 提交按钮事件
      var d = new Date();
      var y = d.getFullYear();
      var m = d.getMonth() + 1;
      m < 10 ? (m = "0" + m) : "" + m;
      var time = y + "-" + m;
      let body = {
        HospitalID: this.orgId,
        DoctorID: this.userId,
        SumScore: this.num,
        ScoreNo: this.ScoreNo,
        GradingNo: "1",
        GroupName: "影像",
        YearMonth: time,
        qc_ScoreDetail: JSON.stringify(this.fromList),
      };
      this.$post("/qc_Score/Create", body).then((res) => {
        this.getFromData();
        this.NNO();
        this.$message({
          message: "操作成功",
          type: "success",
        });
      });
    },
    getFromData() {
      // 获取总表数据
      this.$get("/CommonInfo/GetNo").then((res) => {
        if (res.code == 0) {
          this.ScoreNo = res.data;
        }
      });
    },
    containsSearchText(str, searchText) {
      return str.indexOf(searchText) !== -1;
    },
    setTable() {
      if (this.name_ry == "") {
        this.getTableData()
        return;
      }
      var list = [];
      for (var i in this.tableData) {
        if (this.containsSearchText(this.tableData[i].Username, this.name_ry)) {
          list.push(this.tableData[i]);
        }
      }
      this.tableData = list;
    },
  },
};
</script>

<style>
.el-table .warning-row {
  background: rgb(240, 247, 255);
  font-weight: 700;
  font-size: 14px;
}
.Image_scoring_standard_of_ultrasound_department .tr_style td {
  padding: 1px 10px;
  font-weight: normal;
}
.Image_scoring_standard_of_ultrasound_department .tr_style th {
  padding: 1px 10px;
  font-weight: normal;
}
.Image_scoring_standard_of_ultrasound_department .el-slider__input {
  width: 100px !important;
}
.Image_scoring_standard_of_ultrasound_department .el-slider__runway {
  width: 60px !important;
  margin-right: 110px !important;
}
</style>
